<%@page import="com.huadragon.marathoncore.util.ParseHelper"%>
<%@page import="com.huadragon.marathonentity.common.page.PagerModel"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="com.huadragon.marathoncore.util.PageHelper"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.huadragon.marathonentity.servicedomain.AccountInfoDomain"%>
<%@page import="java.util.List"%>
<table
	class="table table-striped table-bordered table-hover dataTables-example">
	<thead>
		<tr>
			<th width="5%">编号</th>
			<th>真实姓名</th>
			<th>登录名称</th>
			<th>最后操作时间</th>
			<th>启用状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>

		<%
		PagerModel pageModel = (PagerModel) request.getAttribute("PagerModel");
			List<AccountInfoDomain> list = pageModel.getList();
			if (list == null) {
				list = new ArrayList<AccountInfoDomain>();
			}
			for (int i = 0; i < list.size(); i++) {
		%>
		<tr>
			<td><%=(i+1)%></td>
			<td><%=list.get(i).getUserName()%></td>
			<td><%=list.get(i).getLoginName()%></td>
			<td><%=ParseHelper.ToDateString(list.get(i).getUpdateTime(), "") %></td>
			<td><%=list.get(i).getStatus() == 1 ? "√" : "×"%></td>
			<td><a href="javascript:void(0)" onclick="modify(<%=list.get(i).getAccountInfoId()%>)">编辑</a>
			<a href="javascript:void(0)"
				onclick="setauth(<%=list.get(i).getAccountInfoId()%>,<%=list.get(i).getRoleId()%>)">分配权限</a>
			</td>
		</tr>
		<%
			}
		%>
	</tbody>
</table>
<%=PageHelper.getPage(pageModel.getPageSize(),
		pageModel.getPageIndex(), pageModel.getTotal(),
		pageModel.getPagerSize())%>
<script type="text/javascript">
    function modify(accountInfoId) {
    	var paramaters = {
    			"accountInfoId" :  accountInfoId
    		};
    		var url = "/account/getaccountinfo";
    		$.ajax({
    			type : 'POST',
    			url : url,
    			data : paramaters,
    			success : function(result) {
    				$("#txtUserName").val(result.userName);
    				$("#txtLoginName").val(result.loginName);
    				$("#txtPwd").val();
    				$("#txtConfirmPwd").val();
    				if(result.status==1){
    					$("#radyes").prop('checked','checked')
    				}
    				else{
    					$("#radno").prop('checked','checked')
    				}
    			    userid=accountInfoId;
    				optype=1;
    		        $('#myModal').modal('show');
    			}
    		});

    }
    </script>